import axios from '../utils/http'

export const checkLogin = (data) => {
    return axios.post('/users/checkLogin', data)
}
// 获取用户信息
export const getAccountinfo = (data) => {
    return axios.get('/users/accountinfo', { params: data })
}
// 获取用户列表
export const getAccountList = (data) => {
    return axios.get('/users/list', { params: data })
}
// 添加用户
export const addAccount = (data) => {
    return axios.post('/users/add', data)
}
// 删除用户
export const delAccount = (data) => {
    return axios.get('/users/del', { params: data })
}
// 修改账号
export const editAccount = (data) => {
    return axios.post('/users/edit', data)
}
// 修改密码 
export const checkOldpwd = (data) => {
    return axios.get('/users/checkoldpwd', { params: data })
}
export const editPwd = (data) => {
    return axios.post('/users/editpwd', data)
}
// 修改头像
export const avatarEdit = (data) => {
    return axios.get('/users/avataredit', { params: data })
}
// 头像上传
export const avatarUpload = (params, data) => {
    return axios.post('/users/avatar_upload', data, { params: params })
}

//商品
// 商品列表
export const goodsList = (data) => {
    return axios.get('/goods/list', { params: data })
}
//商品删除
export const goodsDelcate = (data) => {
    return axios.get('/goods/del', { params: data })
}
// 添加商品
export const goodsAdd = (data) => {
    return axios.post('/goods/add', data)
}
export const goodsImgUpload = (data) => {
    return axios.post('/goods/goods_img_upload', data)
}
export const cateCategories = (data) => {
    return axios.get('/goods/categories', { params: data })
}
//单个商品详情
export const goodsInfo = (data) => {
    return axios.get('/goods/info', { params: data })
}
//修改商品
export const goodsEdit = (data) => {
    return axios.post('/goods/edit', data)
}

//分类
// 商品分类
export const cateList = (data) => {
    return axios.get('/goods/catelist', { params: data })
}
// 修改分类
export const editCate = (data) => {
    return axios.post('/goods/editcate', data)
}
// 删除分类
export const cateDelete = (data) => {
    return axios.get('/goods/delcate', { params: data })
}
// 添加分类
export const addCate = (data) => {
    return axios.post('/goods/addcate', data)
}

//订单
// 订单列表
export const orderList = (data) => {
    return axios.get('/order/list', { params: data })
}
//订单详情
export const orderDetail = (data) => {
    return axios.get('/order/detail', { params: data })
}
//订单修改
export const orderEdit = (data) => {
    return axios.post('/order/edit', data)
}

//Echarts
// 首页报表
export const echartsTotal = () => {
    return axios.get('/stats/total')
}
// 商品报表
export const echartsGoods = () => {
    return axios.get('/stats/goods')
}
// 订单报表
export const echartsOrder = () => {
    return axios.get('/stats/order')
}

//店铺
//店铺详情
export const getStore = () => {
    return axios.get('/shop/info')
}
//店铺图片
export const uploadImage = (data) => {
    return axios.post('/shop/upload', data)
}
//店铺内容修改
export const editStore = (data) => {
    return axios.post('/shop/edit', data)
}
